package com.miao.aop02;


import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Arrays;

public class AopTest02 {

    @Test
    public void test01(){
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AopConfig2.class);
        //打印容器里面的全部Bean的名字
        Arrays.stream(applicationContext.getBeanDefinitionNames()).forEach(System.out::println);
        System.out.println("############### 以上是全部Bean ######################\n");

        UserController userController = (UserController)applicationContext.getBean("userController");
        UserAddReq userAddReq = new UserAddReq();
        userAddReq.setAge(10);
        userAddReq.setName("张三");
        userAddReq.setTelPhone("11111");
        userAddReq.setImage("");

        userController.addUser(userAddReq);
    }
}
